﻿using Abp.Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Abp.EntityFrameworkCore
{
    public class DbMapping : IEntityTypeConfiguration<Book>
    {
        public void Configure(EntityTypeBuilder<Book> builder)
        {
            builder.HasKey(b => b.Id).HasName("Id");
            builder.ToTable("AbpBook");
            builder.Property(t => t.BookName).IsRequired().HasColumnName("BookName").HasComment("书名");
            builder.Property(t => t.Author).IsRequired().HasColumnName("Author").HasComment("作者");
            builder.Property(t => t.PublishDate).IsRequired().HasColumnName("PublishDate").HasComment("出版日期");
            builder.Property(t => t.Price).IsRequired().HasColumnName("Price").HasComment("价格");
        }
    }
}
